/*
 * ネームエントリー
 */
void
nameentry(int num)
	{
	int	i;
	int	ox,oy;
	int	a,moji;
	int	keycount;

	DspWait();
	KingDsp(2);
	FX73_cmap_i5c4();
	ox = 16;
	oy = 56;
	a = 0;
	moji = 0x41;
	rank[num].name[0] = moji;
	rank[num].name[1] = 0x00;
	rank[num].name[2] = 0x00;
	rank[num].name[3] = 0x00;
	rank[num].name[4] = 0x00;
	keycount = 0;

	// メインループ
	while(1)
		{
		get_pad();

		// 方向キーで文字を選ぶ
		if ( pad00.KD_DAT & KP_left )
			{
			keycount++;
			}
		else if ( pad00.KD_DAT & KP_right )
			{
			keycount--;
			}
		else
			{
			keycount = 0;
			}
		if ( ((pad00.KD_TRG & KP_right) || keycount < -3) && a < 3 )
			{
			moji++;
			if ( moji > 0x5f ) moji = 0x20;
			keycount = 0;
			}
		else if ( ((pad00.KD_TRG & KP_left) || keycount > 3) && a < 3 )
			{
			moji--;
			if ( moji < 0x20 ) moji = 0x5f;
			keycount = 0;
			}
		rank[num].name[a] = moji;

		if ( pad00.KD_TRG & KP_1 )
			{
			// Iボタンで決定
			if ( moji == 0x40 )
				{
				rank[num].name[a] = 0x00;
				break;
				}
			else
				{
				a++;
				if ( a > 2 )
					{
					a = 3;
					moji = 0x40;
					}
				}
			}
		else if ( pad00.KD_TRG & KP_2 )
			{
			// IIボタンで決定
			a--;
			if ( a < 0 ) a = 0;
			moji = rank[num].name[a];
			rank[num].name[a+1] = 0x00;
			}

		StrDspBig(80,24,"RANKING");

		StrDsp(ox+8,oy+num*24+4,"rank");
		NumDspBig(ox+36+8,oy+num*24,num+1);
		NumDspBig2(ox+64,oy+num*24,rank[num].score,6);
		StrDspBig(ox+168,oy+num*24,rank[num].name);

		DspWait();
		VSyncWait();
		}
	}

